-
-
Notifications
You must be signed in to change notification settings - Fork 33k
gh-137065: Unmerge types.UnionType and typing.Union #137069
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Partially revert pythonGH-105499. types.UnionType no longer an alias of typing.Union and no longer subscriptable, but subscribing typing.Union returns an instance of types.UnionType. typing.Union can no longer be used in the isinstance() checks.
e57751f
to
fb8bc3e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think anything should be changed here.
When you're done making the requested changes, leave the comment: |
- Both syntaxes for creating a union now produce the same string representation in | ||
``repr()``. For example, ``repr(Union[int, str])`` | ||
is now ``"int | str"`` instead of ``"typing.Union[int, str]"``. | ||
- Unions created using the old syntax are no longer cached. Previously, running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this was removed; the text would seem to still apply under this PR.
I now think that we need a full revert. See #138967. |
Partially revert GH-105499.
types.UnionType no longer an alias of typing.Union and no longer subscriptable, but subscribing typing.Union returns an instance of types.UnionType. typing.Union can no longer be used in the isinstance() checks.
typing._UnionGenericAlias
, nottyping.Union
#137065📚 Documentation preview 📚: https://cpython-previews--137069.org.readthedocs.build/